package com.jmpt.fangbohui.adapter;

import java.util.List;

import com.jmpt.fangbohui.R;
import com.jmpt.fangbohui.bean.SecondHouseOrderBean.Data;
import com.jmpt.fangbohui.ui.personalcenter.BrokerMyIndentActivity;

import android.content.Context;
import android.view.ContextThemeWrapper;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class SecondHouseOrderAdapter extends BaseAdapter{
	private Context mContext;
	private List<Data> mData;

	public SecondHouseOrderAdapter(Context brokerMyIndentActivity, List<Data> data){
		this.mContext = brokerMyIndentActivity;
		this.mData = data;
	}
	@Override
	public int getCount() {
		return mData.size();
	}

	@Override
	public Object getItem(int position) {
		return mData.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder holder = null;
		if(convertView == null){
			holder = new ViewHolder();
			convertView = View.inflate(mContext, R.layout.item_second_house_order, null);
			holder.AddDate  = (TextView)convertView.findViewById(R.id.AddDate);
			holder.BuyerName = (TextView)convertView.findViewById(R.id.BuyerName);
			holder.BuyerTel  = (TextView)convertView.findViewById(R.id.BuyerTel);
			holder.H_Hall = (TextView)convertView.findViewById(R.id.H_Hall);
			holder.H_MJ = (TextView)convertView.findViewById(R.id.H_MJ);
			holder.H_Room  = (TextView)convertView.findViewById(R.id.H_Room);
			holder.H_SalePrice = (TextView)convertView.findViewById(R.id.H_SalePrice);
			holder.H_SaleUnitPrice  = (TextView)convertView.findViewById(R.id.H_SaleUnitPrice);
			holder.H_Title = (TextView)convertView.findViewById(R.id.H_Title);
			holder.H_payment  = (TextView)convertView.findViewById(R.id.H_payment);
			holder.OrderNum = (TextView)convertView.findViewById(R.id.OrderNum);
			holder.Order_Status = (TextView)convertView.findViewById(R.id.Order_Status);
			holder.SaleUnitPrice_type = (TextView)convertView.findViewById(R.id.SaleUnitPrice_type);
			holder.Saleprice_type = (TextView)convertView.findViewById(R.id.Saleprice_type);
			convertView.setTag(holder);
		}else{
			holder = (ViewHolder) convertView.getTag();
		}
		holder.AddDate.setText(mData.get(position).AddDate);
		holder.BuyerName.setText(mData.get(position).BuyerName);
		holder.BuyerTel.setText(mData.get(position).BuyerTel);
		holder.H_Hall.setText(mData.get(position).H_Hall);
		holder.H_MJ.setText(mData.get(position).H_MJ);
		holder.H_Room.setText(mData.get(position).H_Room);
		holder.H_SalePrice.setText(mData.get(position).H_SalePrice);
		holder.H_SaleUnitPrice.setText(mData.get(position).H_SaleUnitPrice);
		holder.H_Title.setText(mData.get(position).H_Title);
		holder.H_payment.setText(mData.get(position).H_payment);
		holder.OrderNum.setText(mData.get(position).OrderNum);
		holder.Order_Status.setText(mData.get(position).Order_Status);
		holder.SaleUnitPrice_type.setText(mData.get(position).SaleUnitPrice_type);
		holder.Saleprice_type.setText(mData.get(position).Saleprice_type);
		return convertView;
	}
	public class ViewHolder{
		public TextView AddDate;
		public TextView BuyerName;
		public TextView BuyerTel;
		public TextView H_Hall;
		public TextView H_MJ;
		public TextView H_Room;
		public TextView H_SalePrice;
		public TextView H_SaleUnitPrice;
		public TextView H_Title;
		public TextView H_payment;
		public TextView OrderNum;
		public TextView Order_Status;
		public TextView SaleUnitPrice_type; 
		public TextView Saleprice_type;
	}
}
